package 分类.链表;

import java.util.List;

public class 删除排序链表中的重复元素 {
    public ListNode deleteDuplicates(ListNode head) {

        if(head==null) return null;
        ListNode slow=head,fast=head;
        while (fast!=null){
            if(fast.val!=slow.val){
                slow.next=fast;
                slow=slow.next;
            }
            fast=fast.next;
        }
        slow.next=null;
        return head;
    }
}
